package com.lry.basic.rmi;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

public class GreetServiceImpl extends java.rmi.server.UnicastRemoteObject implements GreetService {
 private static final long serialVersionUID = 3434060152387200042L;

 public GreetServiceImpl() throws RemoteException {
   super();
 }

 @Override
 public String sayHello(String name) throws RemoteException {
  return "Hello " + name;
 }

 public static void main(String[] args) throws Exception {

  GreetService greetService = (GreetService)
          Naming.lookup("rmi://localhost:1098/GreetService");

  System.out.println(greetService.sayHello("Jobs"));

 }
}
